package com.dyh.quickdemo.demos.spi;

import lombok.Cleanup;
import org.junit.jupiter.api.Test;
import org.springframework.util.StringUtils;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.Reader;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.ServiceLoader;

/*
@Author=Joey Wheeler
@Date=2020/12/1 14:02
*/
public class Demo {

    public static void main(String[] args) {
        ServiceLoader<MySpiIntf> loader = ServiceLoader.load(MySpiIntf.class);
        Iterator<MySpiIntf> iterator = loader.iterator();
        while (iterator.hasNext()){
            iterator.next().exe();
        }
    }

    @Test
    public void test() throws FileNotFoundException {

        System.out.println(Demo.class.getName());
        System.out.println(Demo.class.getSimpleName());
        System.out.println(StringUtils.uncapitalize(Demo.class.getSimpleName()) );
        System.out.println(Demo.class.getCanonicalName());

//        StringUtils.quote()
//
//        StringUtils.capitalize()
//        @Cleanup Reader fileReader =
//                new FileReader("");
//
//        ServiceLoader<MySpiIntf> loader = ServiceLoader.load(MySpiIntf.class);
//       // loader.iterator()
//        loader.forEach(MySpiIntf::exe);
    }
}
